<template>
  <div class="item">
    <van-checkbox
      class="ischecked"
      @click="checkedChange"
      v-model="orcheck"
      checked-color="#ee0a24"
      icon-size="18px"
    ></van-checkbox>

    <van-swipe-cell class="goodinfo">
      <div class="shopmessage">
        <van-image
          round
          width="2rem"
          height="2rem"
          fit="cover"
          :src="itemInfo.shoplogo"
          class="shop-logo"
        />
        <span class="shoptitle"
          >{{ itemInfo.shopname }}<van-icon name="arrow"
        /></span>
      </div>
      <van-card
        :num="itemInfo.count"
        :title="itemInfo.title"
        class="goods-card"
        :thumb="itemInfo.imgURL"
      >
        <template #tags class="changedmessage">
          <van-tag plain type="danger">标签</van-tag>
        </template>
        <template #price>
          <div class="price">
            <div class="newPrice">￥{{ itemInfo.newPrice }}</div>
            <div class="oldpirce">{{ itemInfo.oldPrice }}</div>
          </div>
        </template>
      </van-card>
      <template #right>
        <van-button square text="删除" type="danger" class="delete-button" />
      </template>
    </van-swipe-cell>
  </div>
</template>

<script>
export default {
  name: "ShopCartItem",
  data() {
    return {
      checked: false,
    };
  },
  props: {
    itemInfo: {
      type: Object,
    },
  },
  components: {
    //
  },
  computed: {
    orcheck() {
      return this.itemInfo.checked;
    },
  },
  methods: {
    checkedChange() {
      this.itemInfo.checked = !this.itemInfo.checked;
      this.checked = this.itemInfo.checked;
     //· console.log(this.itemInfo.checked);
      // console.log("点击");
    },
  },
};
</script>

<style scoped>
.goods-card {
  height: 100% !important;
  margin: 0;
  height: 120px;
  margin-top: 6px;
}

.delete-button {
  height: 100%;
}
.item {
  display: flex;
  width: 95%;
  align-items: center;
  height: 180px;
  border-radius: 10px;
  background: #ffffff;
  margin: 10px auto;
}
ischecked {
  width: 20px;
}
.goodinfo {
  flex: 1;
  padding-top: 12px;
  padding-bottom: 12px;
  background: var(--van-card-background-color);
  /* background: red; */
}
.shoptitle {
  display: inline-block;
  line-height: 2rem;
  font-size: 13px;
  margin-left: 10px;
}
.shopmessage {
  display: flex;
  margin-left: 15px;
}
.shop-logo {
}
.changedmessage {
  margin-top: 10px;
}
.price {
  display: flex;
  width: 150px;
}
.newPrice {
  color: red;
  font-size: 18px;
  flex: 1;
}
.oldpirce {
  flex: 1;
  font-size: 14px;
  text-decoration: line-through;
}
</style>
